package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysBookMapper;
import com.ruoyi.system.domain.SysBook;
import com.ruoyi.system.service.ISysBookService;

/**
 * 图书Service业务层处理
 * 
 * @author 杨正
 * @date 2021-10-09
 */
@Service
public class SysBookServiceImpl implements ISysBookService 
{
    @Autowired
    private SysBookMapper sysBookMapper;

    /**
     * 查询图书
     * 
     * @param bookId 图书主键
     * @return 图书
     */
    @Override
    public SysBook selectSysBookByBookId(Integer bookId)
    {
        return sysBookMapper.selectSysBookByBookId(bookId);
    }

    /**
     * 查询图书列表
     * 
     * @param sysBook 图书
     * @return 图书
     */
    @Override
    public List<SysBook> selectSysBookList(SysBook sysBook)
    {
        return sysBookMapper.selectSysBookList(sysBook);
    }

    /**
     * 新增图书
     * 
     * @param sysBook 图书
     * @return 结果
     */
    @Override
    public int insertSysBook(SysBook sysBook)
    {
        sysBook.setCreateTime(DateUtils.getNowDate());
        return sysBookMapper.insertSysBook(sysBook);
    }

    /**
     * 修改图书
     * 
     * @param sysBook 图书
     * @return 结果
     */
    @Override
    public int updateSysBook(SysBook sysBook)
    {
        sysBook.setUpdateTime(DateUtils.getNowDate());
        return sysBookMapper.updateSysBook(sysBook);
    }

    /**
     * 批量删除图书
     * 
     * @param bookIds 需要删除的图书主键
     * @return 结果
     */
    @Override
    public int deleteSysBookByBookIds(Integer[] bookIds)
    {
        return sysBookMapper.deleteSysBookByBookIds(bookIds);
    }

    /**
     * 删除图书信息
     * 
     * @param bookId 图书主键
     * @return 结果
     */
    @Override
    public int deleteSysBookByBookId(Integer bookId)
    {
        return sysBookMapper.deleteSysBookByBookId(bookId);
    }

    @Override
    public int statusSysBookByBookIds(Integer[] bookIds) {
        return sysBookMapper.statusSysBookByBookIds(bookIds);
    }
}
